Description: Use standard ‘DESTDIR’ environment variable to override destination directory.
Origin: Created to fix build issues in Debian packaging of multiple binary packages.
Author: Ben Finney <ben+debian@benfinney.id.au>
Last-Update: 2014-01-21

=== modified file 'Makefile'
--- old/Makefile	revid:j.luetkens@limitland.de-20131023072122-26ua6glkzx1uxm07
+++ new/Makefile	2014-01-21 00:27:49 +0000
@@ -27,7 +27,6 @@
 CURSORSNAME = ComixCursors
 PACKAGENAME ?= ${CURSORSNAME}
 SUMMARY ?= The original Comix Cursors
-ICONSDIR ?= ${HOME}/.icons
 THEMENAME ?= Custom
 
 GENERATED_FILES :=
@@ -49,8 +48,14 @@
 configfile = ${configdir}/${THEMENAME}.CONFIG
 themefile = ${builddir}/${THEMENAME}.theme
 
-destdir = ${ICONSDIR}/${CURSORSNAME}${THEMEOPTIONS}${THEMEINCLUDE}${SIZENAME}-${THEMENAME}
-xcursor_destdir = ${destdir}/cursors
+ifdef DESTDIR
+icons_destdir = ${DESTDIR}/usr/share/icons
+else
+icons_destdir = ${HOME}/.icons
+endif
+
+theme_destdir = ${icons_destdir}/${CURSORSNAME}${THEMEOPTIONS}${THEMEINCLUDE}${SIZENAME}-${THEMENAME}
+xcursor_destdir = ${theme_destdir}/cursors
 
 template_configfile = ${configdir}/Custom.CONFIG
 template_themefile = ${configdir}/Custom.theme
@@ -89,22 +94,22 @@
 .PHONY: install
 install: all
 # Create necessary directories.
-	install -d "${ICONSDIR}" "${ICONSDIR}/default"
-	$(RM) -r "${destdir}"
+	install -d "${icons_destdir}" "${icons_destdir}/default"
+	$(RM) -r "${theme_destdir}"
 	install -d "${xcursor_destdir}"
 
 # Install the cursors.
 	install -m u=rw,go=r "${xcursor_builddir}"/* "${xcursor_destdir}"
 
 # Install the theme configuration file.
-	install -m u=rw,go=r "${themefile}" "${destdir}/index.theme"
+	install -m u=rw,go=r "${themefile}" "${theme_destdir}/index.theme"
 
 # Install alternative name symlinks for the cursors.
 	$(LINK_CURSORS) "${xcursor_destdir}"
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -r "${destdir}"
+	$(RM) -r "${theme_destdir}"
 
 
 .PHONY: custom-theme

=== modified file 'build-distribution'
--- old/build-distribution	revid:j.luetkens@limitland.de-20131023072122-26ua6glkzx1uxm07
+++ new/build-distribution	2014-01-20 23:53:23 +0000
@@ -43,6 +43,7 @@
 printf "Packaging %s %s...\n" "$themename_root" $VERSION
 
 workdir="$(mktemp -t -d)"
+DESTDIR="${workdir}/dest"
 
 #
 # source package
@@ -68,9 +69,9 @@
 printf "Installing cursor files...\n"
 
 # Make a temporary directory for installing icons into.
-ICONSDIR="${workdir}/icons"
-export ICONSDIR
-mkdir --parents "${ICONSDIR}"
+icons_destdir="${DESTDIR}/usr/share/icons"
+
+export DESTDIR
 
 ./install-all
 
@@ -93,7 +94,7 @@
 
     packagedir="${workdir}/${PACKAGENAME}"
     mkdir --parents "$packagedir"
-    mv "${ICONSDIR}/${PACKAGENAME}"* "$packagedir"/.
+    mv "${icons_destdir}/${PACKAGENAME}"* "$packagedir"/.
 
     tarfile="${distdir}/${PACKAGENAME}-${VERSION}.tar.bz2"
     tar -cjf "$tarfile" --directory "$packagedir" --files-from <(

=== modified file 'install-all'
--- old/install-all	revid:j.luetkens@limitland.de-20131023072122-26ua6glkzx1uxm07
+++ new/install-all	2014-01-20 23:53:23 +0000
@@ -27,10 +27,6 @@
 
 bindir="$(dirname $0)"/bin
 
-# Set the ICONSDIR destination to a default (if not already set).
-ICONSDIR=${ICONSDIR:-~/.icons}
-export ICONSDIR
-
 # We want to use cursors with multiple sizes combined.
 # The script check wether MULTISIZE is exported at all, so don't export
 # MULTISIZE if you want distinct cursor sizes, comment it out here or

